/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package camada.apresentacao.dialog.backup;

import backup.Backup;
import camada.bancodedados.daoimplemente.cliente.PessoaFisicaDAOImpl;
import eloma.classe.Cliente;
import java.util.List;
import java.util.logging.Level;
import org.jdesktop.swingx.error.ErrorInfo;
import utilitarios.Exceptions;
import utilitarios.enviandoEmail;
import utilitarios.erros.MessagemErro;

/**
 *
 * @author Ícaro
 */
public class internalFrmBackup extends javax.swing.JInternalFrame {

    PessoaFisicaDAOImpl daoCliente = new PessoaFisicaDAOImpl();
    Exceptions exceptions = new Exceptions();
    int index = 0;

    List<Cliente> listaCliente;

    /**
     * Creates new form internalFrmCadCliente
     */
    public internalFrmBackup() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtPath = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtDiretorioBanco = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtBanco = new javax.swing.JTextField();
        txtUsuario = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtSenha = new javax.swing.JPasswordField();
        btExecutar = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jXHyperlink1 = new org.jdesktop.swingx.JXHyperlink();
        btNovo = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink3 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink4 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink5 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink6 = new org.jdesktop.swingx.JXHyperlink();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        btPrimeiro = new org.jdesktop.swingx.JXHyperlink();
        btAnterior = new org.jdesktop.swingx.JXHyperlink();
        btProximo = new org.jdesktop.swingx.JXHyperlink();
        btUltimo = new org.jdesktop.swingx.JXHyperlink();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jXHyperlink11 = new org.jdesktop.swingx.JXHyperlink();
        jXHyperlink12 = new org.jdesktop.swingx.JXHyperlink();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        txtSair = new org.jdesktop.swingx.JXHyperlink();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        txtSair1 = new org.jdesktop.swingx.JXHyperlink();
        jSeparator4 = new javax.swing.JSeparator();

        setTitle("Execusão Backup");
        setToolTipText("Execusão Backup");

        jScrollPane1.setBorder(null);

        jLabel1.setText("MYSQL PATH:");

        txtPath.setText("C:\\Program Files\\MySQL\\MySQL Server 5.6\\bin");
        txtPath.setEnabled(false);
        txtPath.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPathActionPerformed(evt);
            }
        });

        jLabel5.setText("Diretório banco:");

        txtDiretorioBanco.setText("C:\\Seloma\\Backup");
        txtDiretorioBanco.setEnabled(false);

        jLabel4.setText("Banco de Dados:");

        txtBanco.setText("eloma");
        txtBanco.setEnabled(false);
        txtBanco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtBancoActionPerformed(evt);
            }
        });

        txtUsuario.setText("root");
        txtUsuario.setEnabled(false);

        jLabel2.setText("Usuario:");

        jLabel3.setText("Senha:");

        txtSenha.setText("i122825");
        txtSenha.setEnabled(false);

        btExecutar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/pequenos/bt_Executar.png"))); // NOI18N
        btExecutar.setText("Executar");
        btExecutar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExecutarActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setText("Para alteração das informações entre em contato com o suporte de desenvolvimento.");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(txtDiretorioBanco)
                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtPath, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtSenha, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtUsuario, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtBanco, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btExecutar)
                    .addComponent(jLabel6))
                .addContainerGap(735, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPath, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtDiretorioBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(3, 3, 3)
                .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btExecutar)
                .addGap(0, 261, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(jPanel2);

        jToolBar1.setFloatable(false);
        jToolBar1.setToolTipText("Cadastro Cliente");

        jXHyperlink1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document.png"))); // NOI18N
        jXHyperlink1.setText("");
        jXHyperlink1.setEnabled(false);
        jXHyperlink1.setFocusable(false);
        jXHyperlink1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink1);

        btNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document_add.png"))); // NOI18N
        btNovo.setText("");
        btNovo.setEnabled(false);
        btNovo.setFocusable(false);
        btNovo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btNovo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btNovo);

        jXHyperlink3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document_ok.png"))); // NOI18N
        jXHyperlink3.setText("");
        jXHyperlink3.setEnabled(false);
        jXHyperlink3.setFocusable(false);
        jXHyperlink3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink3);

        jXHyperlink4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document_edit.png"))); // NOI18N
        jXHyperlink4.setText("");
        jXHyperlink4.setEnabled(false);
        jXHyperlink4.setFocusable(false);
        jXHyperlink4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink4);

        jXHyperlink5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document_error.png"))); // NOI18N
        jXHyperlink5.setText("");
        jXHyperlink5.setEnabled(false);
        jXHyperlink5.setFocusable(false);
        jXHyperlink5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink5);

        jXHyperlink6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/cad/document_delete.png"))); // NOI18N
        jXHyperlink6.setText("");
        jXHyperlink6.setEnabled(false);
        jXHyperlink6.setFocusable(false);
        jXHyperlink6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink6);
        jToolBar1.add(jSeparator1);

        btPrimeiro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/move/media_rewind.png"))); // NOI18N
        btPrimeiro.setText("");
        btPrimeiro.setEnabled(false);
        btPrimeiro.setFocusable(false);
        btPrimeiro.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btPrimeiro.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btPrimeiro);

        btAnterior.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/move/media_step_back.png"))); // NOI18N
        btAnterior.setText("");
        btAnterior.setEnabled(false);
        btAnterior.setFocusable(false);
        btAnterior.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btAnterior.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btAnterior);

        btProximo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/move/media_step_forward.png"))); // NOI18N
        btProximo.setText("");
        btProximo.setEnabled(false);
        btProximo.setFocusable(false);
        btProximo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btProximo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btProximo);

        btUltimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/move/media_fast_forward.png"))); // NOI18N
        btUltimo.setText("");
        btUltimo.setEnabled(false);
        btUltimo.setFocusable(false);
        btUltimo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btUltimo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btUltimo);
        jToolBar1.add(jSeparator2);

        jXHyperlink11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/print/document_view.png"))); // NOI18N
        jXHyperlink11.setText("");
        jXHyperlink11.setEnabled(false);
        jXHyperlink11.setFocusable(false);
        jXHyperlink11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink11);

        jXHyperlink12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/print/printer.png"))); // NOI18N
        jXHyperlink12.setText("");
        jXHyperlink12.setEnabled(false);
        jXHyperlink12.setFocusable(false);
        jXHyperlink12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jXHyperlink12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jXHyperlink12);
        jToolBar1.add(jSeparator5);

        txtSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/internal/move/window_delete.png"))); // NOI18N
        txtSair.setText("");
        txtSair.setFocusable(false);
        txtSair.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        txtSair.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        txtSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSairActionPerformed(evt);
            }
        });
        jToolBar1.add(txtSair);
        jToolBar1.add(jSeparator3);

        txtSair1.setText("");
        txtSair1.setFocusable(false);
        txtSair1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        txtSair1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        txtSair1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSair1ActionPerformed(evt);
            }
        });
        jToolBar1.add(txtSair1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jSeparator4))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSairActionPerformed
        this.setVisible(false);
    }//GEN-LAST:event_txtSairActionPerformed

    private void txtPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPathActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPathActionPerformed

    private void txtBancoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBancoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtBancoActionPerformed

    private void btExecutarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExecutarActionPerformed
        try {

            Backup bk = new Backup(txtUsuario.getText(), txtSenha.getText(), txtDiretorioBanco.getText(), txtBanco.getText(), txtPath.getText());
            enviandoEmail e = new enviandoEmail();

        } catch (Exception e) {
            MessagemErro erro = new MessagemErro(new ErrorInfo("Erro no Sistema", "Não é Possível Continuar, Sistema Inativo", null, "Fatal", e, Level.WARNING, null), 1);
        }
    }//GEN-LAST:event_btExecutarActionPerformed

    private void txtSair1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSair1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtSair1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.JXHyperlink btAnterior;
    private javax.swing.JButton btExecutar;
    private org.jdesktop.swingx.JXHyperlink btNovo;
    private org.jdesktop.swingx.JXHyperlink btPrimeiro;
    private org.jdesktop.swingx.JXHyperlink btProximo;
    private org.jdesktop.swingx.JXHyperlink btUltimo;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar jToolBar1;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink1;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink11;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink12;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink3;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink4;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink5;
    private org.jdesktop.swingx.JXHyperlink jXHyperlink6;
    private javax.swing.JTextField txtBanco;
    private javax.swing.JTextField txtDiretorioBanco;
    private javax.swing.JTextField txtPath;
    private org.jdesktop.swingx.JXHyperlink txtSair;
    private org.jdesktop.swingx.JXHyperlink txtSair1;
    private javax.swing.JPasswordField txtSenha;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables

}
